#include <stdio.h>
#include <algorithm>
#include <list>
using namespace std;

int n;
list<int> ls;
int temp;

int main() {
	scanf("%d", &n);

	for (int i=0; i<n; i++) {
		scanf("%d", &temp);
		ls.push_back(temp);
	}

	ls.sort();
	ls.unique();

	list<int>::iterator it = ls.begin();
	it++;

	if (it != ls.end())
		printf("%d\n", *it);
	else
		printf("NO\n");

	return 0;
}
